package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Spshenhe;
import com.ruoyi.system.service.ISpshenheService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 商品审核状态Controller
 * 
 * @author ruoyi
 * @date 2024-08-12
 */
@RestController
@RequestMapping("/system/spshenhe")
public class SpshenheController extends BaseController
{
    @Autowired
    private ISpshenheService spshenheService;

    /**
     * 查询商品审核状态列表
     */
    @PreAuthorize("@ss.hasPermi('system:spshenhe:list')")
    @GetMapping("/list")
    public TableDataInfo list(Spshenhe spshenhe)
    {
        startPage();
        List<Spshenhe> list = spshenheService.selectSpshenheList(spshenhe);
        return getDataTable(list);
    }

    /**
     * 导出商品审核状态列表
     */
    @PreAuthorize("@ss.hasPermi('system:spshenhe:export')")
    @Log(title = "商品审核状态", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Spshenhe spshenhe)
    {
        List<Spshenhe> list = spshenheService.selectSpshenheList(spshenhe);
        ExcelUtil<Spshenhe> util = new ExcelUtil<Spshenhe>(Spshenhe.class);
        util.exportExcel(response, list, "商品审核状态数据");
    }

    /**
     * 获取商品审核状态详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:spshenhe:query')")
    @GetMapping(value = "/{spshId}")
    public AjaxResult getInfo(@PathVariable("spshId") Long spshId)
    {
        return success(spshenheService.selectSpshenheBySpshId(spshId));
    }

    /**
     * 新增商品审核状态
     */
    @PreAuthorize("@ss.hasPermi('system:spshenhe:add')")
    @Log(title = "商品审核状态", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Spshenhe spshenhe)
    {
        return toAjax(spshenheService.insertSpshenhe(spshenhe));
    }

    /**
     * 修改商品审核状态
     */
    @PreAuthorize("@ss.hasPermi('system:spshenhe:edit')")
    @Log(title = "商品审核状态", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Spshenhe spshenhe)
    {
        return toAjax(spshenheService.updateSpshenhe(spshenhe));
    }

    /**
     * 删除商品审核状态
     */
    @PreAuthorize("@ss.hasPermi('system:spshenhe:remove')")
    @Log(title = "商品审核状态", businessType = BusinessType.DELETE)
	@DeleteMapping("/{spshIds}")
    public AjaxResult remove(@PathVariable Long[] spshIds)
    {
        return toAjax(spshenheService.deleteSpshenheBySpshIds(spshIds));
    }
}
